package com.ndp.fb.walle.util;

import com.ndp.fb.rdb.model.User;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2015/3/26.
 */
public class RequestUtils {
    /**
     *  获取当前session中userid
     * @param request
     * @return
     */
    public static String getUserId(HttpServletRequest request) {
        User user = (User) request.getSession().getAttribute("user");
        if(user == null){
            throw new RuntimeException("用户没有登陆");
        } else {
            return user.getTicket();
        }
    }

    public static String getTimeZoneId(HttpServletRequest request){
        User user = (User) request.getSession().getAttribute("user");
        if(user == null){
            throw new RuntimeException("用户没有登陆");
        } else {
            return user.getTimezoneId();
        }
    }
}
